<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .green {
      color: green;
    }

    .red {
      color: red;
    }

    .large {
      font-size: 50px;
    }
  </style>
</head>

<div id="app"></div>
<!-- v-bind用来绑定标签的属性  ，v-on 用来绑定标签的事件-->
<template id="my-app">
  <div>
    <!-- <h2 @click="changeColor" v-bind:class="className">{{message}}</h2> -->
    <!-- <h2 @click="changeColor" class="green" v-bind:class="{'red':isActive,'large':isActive}">{{message}}</h2> -->
    <h2 @click="changeColor" class="green" v-bind:class="getClassObj()">{{message}}</h2>

    <a v-bind:href="link" :style="styleObj">百度</a>

    <div v-bind="info">Hello</div>
  </div>
</template>

<body>
  <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>


  <script>
    Vue.createApp({
      template: '#my-app',
      data: function () {
        return {
          message: 'Hello World',
          className: '',
          isActive: false,
          islarge: false,
          link:'https://www.baidu.com',
          styleObj:{
            color:'green'
          },
          info:{
            name:'wn',
            age:18
          }
        }
      },
      methods: {
        changeColor() {
          // this.className='red'
          this.isActive = 'true'
          this.islarge = 'true'
        },
        getClassObj() {
          return {
            red: true,
            large: true
          }
        }
      }



    }).mount('#app')
  </script>
</body>

</html>